package linwen.wang.exception.commom;


import linwen.wang.exception.exception.BizException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * @ClassName GlobalExceptionHandler
 * @Description
 * @Author lin
 * @Date 2022/3/25 下午11:00
 * @Version V1.0
 */

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BizException.class)
    @ResponseBody
    public ResultVO handleIllegalArgumentPlumException(BizException e) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode("500");
        resultVO.setMessage(e.getLocalizedMessage());
        resultVO.setResult(-1);
        return resultVO;
    }
}
